package counter;
import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

import testharness.ConcurrentHarness;

public class TestUnsafeCounter extends ConcurrentHarness {

	private UnsafeCounter counter;

	@Before
	public void initCounter() {
		counter = new UnsafeCounter();
	}

	@Test
	public void testUnsafeCounter() {
		submitTasks();
	}

	@Override
	protected Runnable newTask() {
		return new Runnable() {
			@Override
			public void run() {
				counter.increment();
			}
		};
	}

	public void checkResults() {
		assertEquals(CYCLES, counter.getCounter());
	}

}
